package com.joyintech.modules.workflow.service;

import com.joyintech.base.PageInfo;
import com.joyintech.modules.workflow.service.dto.ModelQueryCriteria;
import org.activiti.engine.repository.Model;
import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.Map;
import java.util.Set;

public interface WorkFlowService {

    // 流程定义
    PageInfo<Map<String,Object>> listProcessDefinitions(ModelQueryCriteria queryCriteria, Pageable pageable);
    // 流程模型
    PageInfo<Model> listModel(ModelQueryCriteria queryCriteria, Pageable pageable) throws Exception;

    void uploadProcessDefinitions(MultipartFile file,boolean isSyncConvert) throws Exception;

    /**
     * 删除流程定义文件
     * @param ids
     * @param cascade 级联删除流程实例
     */
    void deleteProcessDefinitions(Set<String> ids,boolean cascade);


    /**
     * 激活或挂起
     * @param procDefId
     * @param state
     */
    void updateProcessDefinitions(String procDefId, String state);

    /**
     * 转为模型
     * @param deploymentId
     */
    void convertProcessDefinitions(String deploymentId) throws Exception;

    void showProcessDefinitionsDiagrams(HttpServletResponse response, String procDefId) throws Exception;

    /**
     * 导出部署包
     * @param id
     */
    void downloadModel(String id);

    /**
     * 删除模型
     * @param ids
     */
    void deleteModel(Set<String> ids);

    /**
     * 流程部署
     * @param id
     */
    void deployModel(String id);

    /**
     * 删除流程实例
     * @param procInsId
     * @param reason
     */
    void deleteProcessInstance(String procInsId, String reason);
}
